<?php
class lib_site_order_log extends lib_base{
	public $table_name = "qc_site_order_log";
    public $pk = "id";

    public function add_log($order_id,$data){

    	$msg = array(
    		'1'=>'订单新提交',
    		'2'=>'订单已派送',
    		'3'=>'订单已确认',
    		'4'=>'订单跟进中',
    		'5'=>'订单已完成',
    		'6'=>'订单已评价',
    		'7'=>'订单已结算',
    		'99'=>'订单已取消',
    	);
    	$intro['msg'] = $msg[$data['order_status']];
        if($data['order_status'] > 1){
            if($data['urls']) $intro['imgs'] = joinStr($data['urls']);
            if($data['intro']) $intro['intro'] = $data['intro'];
        }
        $data['device_id'] = $data['device_id']?$data['device_id']:0;

    	$order = D('site_order')->findById($order_id);
    	if($order){
	        $arrBase = array(
	        	'order_id' =>$order_id,
				'admin_id' =>$order['admin_id'],
                'device_id' =>$order['device_id'],
				'intro' =>serialize($intro),
				'order_status' =>$order['order_status'],
				'status' =>1,
				'add_time'=>date('Y-m-d H:i:s'),
			);
			return $this->add($arrBase);
    	}
    	
    }
}